<?php
session_start();
include_once("conn.php");

$username = $_POST["username"];
$password = $_POST["password"];

$action = $_POST["action"];
if($action == "login")
{
	$username = stripslashes(trim($username));
	$password = stripslashes(trim($password));

	$sql = "select * from bbs_user where u_anme = '".$username."' && u_password = '".$password."'";
	$result = mysql_query($sql);
	if(!empty($result))
	{
		date_default_timezone_set("PRC");
		$login_time = date("Y-m-d H:i:s",time());
		
		$_SESSION["current_user"] = $username;

		$rs["msg"] = "登录成功";
		$rs["time"] = $login_time;
		$rs["name"] = $username;
	}
	else {
		$rs["msg"] = "用户名、密码错误或者未注册";

	}

	echo json_encode($rs);
	
}


?>